<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    #box{
      width: 200px;
      height: 200px;
      background: rgb(6, 73, 73);
    }
  </style>
</head>
<body>
  <div id="box" onclick="console.log('three')"></div>
  <a href="http://www.baidu.com">百度</a>
  <input type="text">
  <script>
    let box = document.querySelector('#box')

    //绑定单击事件
    box.onclick = function(e){
      // console.log('one')
      console.log(e);
    }

    // //绑定单击事件
    // box.addEventListener('click', function(){
    //   console.log('two')
    // });


    //获取 a 元素
    let a = document.querySelector('a')
    a.onclick = function(e){
      //1. return false;
      // return false;
      //2. e.preventDefault
      e.preventDefault();
    }

    //获取 input 元素
    let input = document.querySelector('input')
    //on 当...时候  change 改变
    input.onchange = function(){
      console.log('值发生了改变')
    }
  </script>
</body>
</html>